﻿using System;
using System.ComponentModel;
using System.Windows;

namespace FU.Capstones.IMS.Web.Silverlight.Controls
{
    public partial class DeleteHyperlinkButtonControl : INotifyPropertyChanged
    {
        public DeleteHyperlinkButtonControl() 
        {
            InitializeComponent();
            DataContext = this;
        }

        public Object SelectedID
        {
            get { return (Object)GetValue(SelectedIDProperty); } 
            set
            {
                if (!ReferenceEquals(GetValue(SelectedIDProperty), value))
                {
                    SetValue(SelectedIDProperty, value);
                    OnPropertyChanged("SelectedID");
                }
            }
        }

        public static readonly DependencyProperty SelectedIDProperty = 
            DependencyProperty.Register("SelectedID", typeof(Object), typeof (DeleteHyperlinkButtonControl), null);

        public Object DataSource
        {
            get { return (Object)GetValue(DataSourceProperty); }
            set
            {
                if(!ReferenceEquals(GetValue(DataSourceProperty), value))
                {
                    SetValue(DataSourceProperty, value);
                    OnPropertyChanged("DataSource");
                }
            }
        }

        public static readonly DependencyProperty DataSourceProperty =
            DependencyProperty.Register("DataSource", typeof(Object), typeof(DeleteHyperlinkButtonControl), null);

        #region Implementation of INotifyPropertyChanged

        public event PropertyChangedEventHandler PropertyChanged;

        private void OnPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        #endregion
    }
}
